package com.explorati.stack;

public class InitStack<E> {

	private E[] data;
	private int size;
	
	public InitStack(int capacity){
		data = (E[])new Object[capacity];
		size = 0;
	}
	
	public InitStack(){
		this(10);
	}
	
	public void push(E e){
		data[size] = e;
		size ++;
	}
	
	public E pop(){
		size --;
		return data[size - 1];
	}
	
	public E peek(){
		return data[size - 1];
	}
	
	public boolean isEmpty(){
		return size == 0;
	}
	
	public int getSize(){
		return data.length;
	}
}
